'''
异或实现
'''
def find_single_num(nums):
    result = 0
    for num in nums:
        result ^= num
    return result

'''
字典（哈希表）实现
'''
def find_single_num2(nums):
    num_dict = {}
    for num in nums:
        if(num in num_dict):
            num_dict[num] += 1
        else:
            num_dict[num] = 1
    for num in num_dict:
        if(num_dict[num] == 1):
            return num

#示例
nums = [1, 2, 3, 4, 4, 6, 6, 3, 2]
print("出现一次的数为：")
print(find_single_num(nums))
print(find_single_num2(nums))
